Error while sending xml file to Sharepoint server with 64bits computers

Hi everyone ! Smile
I encounter a tough problem using ole automation.
I try to send and store an xml file on a SharePoint server using a soap request (CopyIntoItems).
The piece of code I use is as follow:

string output           // string containing the content of the xml file
string outputBase64Encoded              // string containing the content of the xml file, encoded base 64

// Base64 encoding (necessary to store into Sharepoint)
toBase64_ (output, outputBase64Encoded)


// Sharepoint server address definition
string local_path_site = "http://sharepoint.portal.int/PATH_TO_STORE_THE_FILE/"
string wsdl = "_vti_bin/copy.asmx"
string action = "http://schemas.microsoft.com/sharepoint/soap/CopyIntoItems"  // soap request used for this task : CopyIntoItems


// Creation of the HTTP request object
OleAutoObj xhr = oleCreateAutoObject "MSXML2.XMLHTTP"
OleAutoArgs objArg = create


// Opening an HTTP POST request
clear objArg
put(objArg, "bstrMethod", "POST")
put(objArg, "bstrUrl", local_path_site wsdl)
put(objArg, "varAsync", false)
put(objArg, "bstrUser", "USERNAME")
put(objArg, "bstrPassword", "PASSWORD")
string result1 = oleMethod(xhr, "Open", objArg)


// Sending the first header request
clear objArg
put(objArg, "bstrHeader", "Content-Type")
put(objArg, "bstrValue", "text/xml; charset=utf-8")
string result2 = oleMethod(xhr, "setRequestHeader", objArg)


// Sending the second header request
clear objArg
put(objArg, "bstrHeader", "SOAPAction")
put(objArg, "bstrValue", action)
string result3 = oleMethod(xhr, "setRequestHeader", objArg)


// Concatenation of the soap request CopyIntoItems
string soap = "<?xml version=\"1.0\" encoding=\"utf-8\"?>
<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:m=\"http://schemas.microsoft.com/sharepoint/soap/\">  
        <soap:Header></soap:Header>
        <soap:Body>
                <m:CopyIntoItems>
                        <m:SourceUrl>C:\\temp\\output.xml</m:SourceUrl>                     // Path where the xml file is currently stored
                        <m:DestinationUrls>
                                <m:string>http://sharepoint.portal.int/PATH_TO_STORE_THE_FILE/output.xml</m:string>                 // Path on the sharepoint server where I want the xml file to be stored
                        </m:DestinationUrls>
                        <m:Fields></m:Fields>
                        <m:Stream>" outputBase64Encoded "</m:Stream>              // Here I indicate the base64 encoded file content
                </m:CopyIntoItems>
        </soap:Body>
</soap:Envelope>"


// Sending the soap request
clear objArg
put(objArg, soap)

string result4 = oleMethod(xhr, "Send", objArg)


This code works perfectly on 32 bits computers, but not on other computers, which appear to be 64 bits computers.
On 64 bits computers we get some OLE errors when printing the strings result3 or result4, but not in result1 and result2.
DOORS version is 9.6

 

My questions are:

  • Are you aware of a different behaviour of the base64 encoding function between 32 bits and 64 bits computers ?
  • If yes, do you know how to fix it, or an alternative solution ?
  • If no, do you have any clue or hint we can try ?

Thanks in advance for any kind of help ! Idea

 


laydgeur - Tue Jan 17 11:04:37 EST 2017

Re: Error while sending xml file to Sharepoint server with 64bits computers
Mathias Mamsch - Wed Jan 18 03:56:28 EST 2017

Can you give the exact errors you get and the line of code? This code is hard to try, if you do not have the right setup. Additionally can you post the following info: 

  • Do you get this problem on 64 bit computers or computers running a 64 bit DOORS client? (i.e. running the code on a 64 bit computer with DOORS 32 bit client works?) 
  • You mentioned differences in the base64 encoding function for 64 / 32 bit clients/computers ... Did you compare the generated base64 strings from two machines? Are there differences? 
  • You mentioned you get OLE errors, but you need to post the exact error messages. Are these messages incompatibility messages from the OLE API or simply error messages from the functions you call? 

Regards, Mathias

Re: Error while sending xml file to Sharepoint server with 64bits computers
laydgeur - Tue Jan 24 08:05:17 EST 2017

Mathias Mamsch - Wed Jan 18 03:56:28 EST 2017

Can you give the exact errors you get and the line of code? This code is hard to try, if you do not have the right setup. Additionally can you post the following info: 

  • Do you get this problem on 64 bit computers or computers running a 64 bit DOORS client? (i.e. running the code on a 64 bit computer with DOORS 32 bit client works?) 
  • You mentioned differences in the base64 encoding function for 64 / 32 bit clients/computers ... Did you compare the generated base64 strings from two machines? Are there differences? 
  • You mentioned you get OLE errors, but you need to post the exact error messages. Are these messages incompatibility messages from the OLE API or simply error messages from the functions you call? 

Regards, Mathias

Hi Mathias and thank you for your feedback !

I will gather the information you suggested and post it hereafter.